import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;


public class TestTracker {

		public static void main(String[] args) {
			try{
			Socket s = new Socket("localhost", 60023);
			PrintWriter p = new PrintWriter(s.getOutputStream());
			
			InputStreamReader in = new InputStreamReader(s.getInputStream());
			
			//p.print("announce listen 4000 seed [a.out 123 12 00383366b82bafbf66c13f6117ea61a5] leech [5f78f8c086a49ec369d447713fa2dd08]");
			p.print("announce listen 3000 seed [a.out 123 12 00383366b82bafbf66c13f6117ea61a5] leech []");
			p.flush();
			
			char[] cbuf = new char[10];
			in.read(cbuf);
			
			System.out.println(cbuf);
			
			Thread.currentThread().sleep(3000);
			
			p.print("getfile 00383366b82bafbf66c13f6117ea61a5");
			p.flush();
			char[] cbuf2 = new char[56];
			in.read(cbuf2);
			System.out.println(cbuf2);
			
			
			Thread.currentThread().sleep(3000);
			p.print("look [filename=\"a.out\"]");
			p.flush();
			
			char[] cbuf3 = new char[100];
			in.read(cbuf3);
			System.out.println(cbuf3);
			
			Thread.currentThread().sleep(3000);
			p.print("update seed [] leech []");
			p.flush();
			
			
			}
			catch(Exception e){
			e.printStackTrace();
			}

	}
}
